import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
import LayoutView from '../views/LayoutView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'layout',
    component: LayoutView,
    children: [
      {
        path: '',
        name: 'home',
        component: HomeView
      },
      {
        path: 'public',
        name: 'public',
        component: () => import('../views/ActivityPublic.vue')
      },
      {
        path: 'message',
        name: 'message',
        component: () => import('../views/MessageView.vue')
      },
      {
        path: 'me',
        name: 'me',
        component: () => import('../views/MeView.vue')
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/LoginView.vue')
  },
  {
    path: '/activitydetail',
    name: 'activitydetail',
    component: () => import('../views/ActivityDetail.vue')
  },
  {
    path: '/myactivity',
    name: 'myactivity',
    component: () => import('../views/MyActivity.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
